import type { VxeGridProps } from '#/adapter/vxe-table'
import { $t } from '@vben/locales'
import { accountStatusOptions, networkGroupOptions, isPackedOptions } from '#/config/options/status'
import dayjs from 'dayjs'
// 列表表头
export const columns: VxeGridProps['columns'] = [
    { align: 'center', title: '', type: 'checkbox', width: 80 },
    { title: '序号', type: 'seq', width: 50 },
    { field: 'avatar', title: '头像', slots: { default: 'avatar' }, width: 280 },
    { field: 'email', title: '绑定邮箱' },
    { field: 'password', title: '登录密码' },
    { field: 'location', title: '地区' },
    {
        field: 'isPack',
        title: '是否包装',
        cellRender: {
            name: 'OptionsText',
            props: {
                options: isPackedOptions
            }
        }
    },
    {
        field: 'status',
        title: '账号状态',
        cellRender: {
            name: 'OptionsText',
            props: {
                options: accountStatusOptions
            }
        }
    },
    // TODO 字段没对
    { field: 'emailVerified', title: '邮箱验证状态',slots: { default: 'emailVerified' },},
    { field: 'onlineStatus', title: '在线状态' },
    { field: 'networkGroupId', title: '网络分组' },
    { field: 'createTime', title: '注册时间',width: 200 },
    

    { field: 'remark', title: '备注' },
    {
        field: 'action',
        fixed: 'right',
        slots: { default: 'action' },
        title: $t('common.action'),
        width: 320
    }
]

export const formSchema = [
    {
        fieldName: 'username',
        label: '账号名',
        component: 'Input'
    },
    {
        fieldName: 'email',
        label: '绑定邮箱',
        component: 'Input'
    },
    {
        fieldName: 'location',
        label: '地区',
        component: 'Input'
    },
    {
        fieldName: 'isPack',
        label: '是否已包装',
        component: 'Select',
        componentProps: {
            options: isPackedOptions
        }
    },
    {
        fieldName: 'status',
        label: '账号状态',
        component: 'Select',
        componentProps: {
            options: accountStatusOptions
        }
    },
    {
        fieldName: 'networkGroupId',
        label: '网络分组',
        component: 'Textarea'
    },
    {
        fieldName: 'isSendActiveEmail',
        label: '邮箱验证状态',
        component: 'Select',
        componentProps: {
            options: [
                { label: '全部', value: "null" },
                { label: '已验证', value: true },
                { label: '未验证', value: false }
            ]
        }
    },
    {
        // TODO 字段没对
        fieldName: 'onlineStatus',
        label: '在线状态',
        component: 'Select',
        componentProps: {
            options: [
                { label: '全部', value: "null" },
                { label: '在线', value: true },
                { label: '离线', value: false }
            ]
        }
    },
    {
            fieldName: 'createTime',
            label: '注册时间',
            component: 'RangePicker',
            componentProps: {
                showTime: {
                    disabledTime: false,
                    defaultValue: [dayjs('00:00:00', 'HH:mm:ss'), dayjs('23:59:59', 'HH:mm:ss')]
                },
                format: 'YYYY-MM-DD HH:mm:ss',
                valueFormat: 'YYYY-MM-DD HH:mm:ss'
            }
        },
    {
        fieldName: 'remark',
        label: '备注',
        component: 'Input'
    }
]
